﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using EventLogAnalyzer.ViewModel;

namespace EventLogAnalyzer.View
{
    /// <summary>
    /// Interaction logic for EventLogFilesListControl.xaml
    /// </summary>
    public partial class EventLogFilesListControl : UserControl
    {
        public EventLogFilesListControl()
        {
            InitializeComponent();
            Loaded += new RoutedEventHandler(EventLogFilesListControl_Loaded);
            SizeChanged += new SizeChangedEventHandler(EventLogFilesListControl_SizeChanged);
        }

        void EventLogFilesListControl_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            scroll.Height = this.ActualHeight - 40;
        }

        void EventLogFilesListControl_Loaded(object sender, RoutedEventArgs e)
        {
            scroll.Height = this.ActualHeight - 40;
        }

        private void logEntry_MouseDown(object sender, MouseButtonEventArgs e)
        {
            var eventLogViewModel = (EventLogViewModel)((TextBlock)sender).DataContext;
            eventLogViewModel.ShowEventDetailsCommand.Execute(null);
        }
    }
}
